home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / bstfiles.zoo / chicago.bst (.txt) < prev    next >
LaTeX Document  |  1992-08-05  |  35KB  |  1,301 lines

  1. %$$$ chicago.bst $$$
  2. % "Chicago" BibTeX style, chicago.bst
  3. % ===================================
  4. % BibTeX `chicago' style file for BibTeX version 0.99c, LaTeX version 2.09
  5. % Place it in a file called chicago.bst in the BibTeX search path.
  6. % You need to include chicago.sty as a \documentstyle option.
  7. % (Placing it in the same directory as the LaTeX document should also work.)
  8. % This "chicago" style is based on newapa.bst (American Psych. Assoc.)
  9. % found at ymir.claremont.edu.
  10. %   Citation format: (author-last-name year)
  11. %             (author-last-name and author-last-name year)
  12. %             (author-last-name, author-last-name, and author-last-name year)
  13. %             (author-last-name et al. year)
  14. %             (author-last-name)
  15. %             author-last-name (year)
  16. %             (author-last-name and author-last-name)
  17. %             (author-last-name et al.)
  18. %             (year) or (year,year)
  19. %             year or year,year
  20. %   Reference list ordering: alphabetical by author or whatever passes
  21. %    for author in the absence of one.
  22. % This BibTeX style has support for abbreviated author lists and for
  23. %    year-only citations.  This is done by having the citations
  24. %    actually look like
  25. %    \citeauthoryear{full-author-info}{abbrev-author-info}{year}
  26. % The LaTeX style has to have the following (or similar)
  27. %     \let\@internalcite\cite
  28. %     \def\fullcite{\def\citeauthoryear##1##2##3{##1, ##3}\@internalcite}
  29. %     \def\fullciteA{\def\citeauthoryear##1##2##3{##1}\@internalcite}
  30. %     \def\shortcite{\def\citeauthoryear##1##2##3{##2, ##3}\@internalcite}
  31. %     \def\shortciteA{\def\citeauthoryear##1##2##3{##2}\@internalcite}
  32. %     \def\citeyear{\def\citeauthoryear##1##2##3{##3}\@internalcite}
  33. % These TeX macro definitions are found in chicago.sty. Additional
  34. % commands to manipulate different components of a citation can be defined
  35. % so that, for example, you can list author's names without parentheses
  36. % if using a citation as a noun or object in a sentence.
  37. % This file was originally copied from newapa.bst at ymir.claremont.edu.
  38. % Features of chicago.bst:
  39. % =======================
  40. % - full names used in citations, but abbreviated citations are available
  41. %   (see above)
  42. % - if an entry has a "month", then the month and year are also printed
  43. %   as part of that bibitem.
  44. % - book, inbook, and manual use "location: publisher" (or organization)
  45. %   for address and publisher. All other types list publishers separately.
  46. % - "pp." are used to identify page numbers for all entry types except
  47. %   articles.
  48. % - organization is used as a citation label if neither author nor editor
  49. %   is present (for manuals).
  50. % - "et al." is used for long author and editor lists.
  51. % Modified by Glenn Paulley, University of Waterloo, July, 1992 (mostly
  52. % from Chicago Manual of Style):
  53. % Modifications: (from newapa.bst)
  54. % =============
  55. %   - added month, year to bib entries if month is present
  56. %   - fixed bug with In proceedings, added necessary comma after title
  57. %   - all conjunctions changed to "and" from "\&"
  58. %   - fixed bug with author labels in my.full.label: "et al." now is
  59. %        generated when "others" is an author name
  60. %   - major modification from Chicago Manual of Style (13th ed.) is that
  61. %     only the first author in a reference appears last name first-
  62. %     additional authors appear as J. Q. Public.
  63. %   - pages are listed as "pp. xx-xx" in all entry types except
  64. %     article entries. Unnecessary (IMHO) "()" around page numbers
  65. %     were removed, and page numbers now don't end with a period.
  66. %   - created chicago.sty for use with this bibstyle (required).
  67. %   - fixed bugs in FUNCTION {format.vol.num.pages} for missing volume,
  68. %     number, and /or pages. Renamed to format.jour.vol.
  69. %   - fixed bug in formatting booktitles: additional period an error if
  70. %     book has a volume.
  71. %   - fixed bug: editors usually given redundant period before next clause
  72. %     (format.editors.dot) removed.
  73. %   - added label support for organizations, if both author and editor
  74. %     are missing (from alpha.bst). If organization is too long, then
  75. %     the key field is used for abbreviated citations.
  76. %   - In proceedings or books of several volumes, no comma was written
  77. %     between the "Volume x" and the page numbers (this was intentional
  78. %     in newapa.bst). Fixed.
  79. %   - Some journals may not have volumes/numbers, only month/year (eg.
  80. %     IEEE Computer). Fixed bug in article style that assumed volume/number
  81. %     was always present.
  82. % Original documentation for newapa.sty:
  83. % =====================================
  84. % This version was made by modifying the master file made by
  85. % Oren Patashnik (PATASHNIK@SCORE.STANFORD.EDU), and the 'named' BibTeX
  86. % style of Peter F. Patel-Schneider.
  87. % Copyright (C) 1985, all rights reserved.
  88. % Copying of this file is authorized only if either
  89. % (1) you make absolutely no changes to your copy, including name, or
  90. % (2) if you do make changes, you name it something other than 'newapa.bst'.
  91. % There are undoubtably bugs in this style.  If you make bug fixes,
  92. % improvements, etc.  please let me know.  My e-mail address is:
  93. %    spencer@cgrg.ohio.state.edu or 71160.3141@compuserve.com
  94. % This style was made from 'plain.bst', 'named.bst', and 'apalike.bst',
  95. % with lots of tweaking to make it look like APA style, along with tips
  96. % from Young Ryu and Brian Reiser's modifications of 'apalike.bst'.
  97. ENTRY
  98.   { address
  99.     author
  100.     booktitle
  101.     chapter
  102.     edition
  103.     editor
  104.     howpublished
  105.     institution
  106.     journal
  107.     key
  108.     month
  109.     note
  110.     number
  111.     organization
  112.     pages
  113.     publisher
  114.     school
  115.     series
  116.     title
  117.     type
  118.     volume
  119.     year
  120.   { label extra.label sort.label }
  121. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  122. FUNCTION {init.state.consts}
  123. { #0 'before.all :=
  124.   #1 'mid.sentence :=
  125.   #2 'after.sentence :=
  126.   #3 'after.block :=
  127. STRINGS { s t u }
  128. FUNCTION {output.nonnull}
  129. { 's :=
  130.   output.state mid.sentence =
  131.     { ", " * write$ }
  132.     { output.state after.block =
  133.     { add.period$ write$
  134.       newline$
  135.       "\newblock " write$
  136.     }
  137.     { output.state before.all =
  138.         'write$
  139.         { add.period$ " " * write$ }
  140.       if$
  141.     }
  142.       if$
  143.       mid.sentence 'output.state :=
  144.     }
  145.   if$
  146. % Use a colon to separate output. Used only for address/publisher
  147. % combination in book/inbook types, address/institution for manuals,
  148. % and organization:publisher for proceedings (inproceedings).
  149. FUNCTION {output.nonnull.colon}
  150. { 's :=
  151.   output.state mid.sentence =
  152.     { ": " * write$ }
  153.     { output.state after.block =
  154.     { add.period$ write$
  155.       newline$
  156.       "\newblock " write$
  157.     }
  158.     { output.state before.all =
  159.         'write$
  160.         { add.period$ " " * write$ }
  161.       if$
  162.     }
  163.       if$
  164.       mid.sentence 'output.state :=
  165.     }
  166.   if$
  167. FUNCTION {output}
  168. { duplicate$ empty$
  169.     'pop$
  170.     'output.nonnull
  171.   if$
  172. FUNCTION {output.colon}
  173. { duplicate$ empty$
  174.     'pop$
  175.     'output.nonnull.colon
  176.   if$
  177. FUNCTION {output.check}
  178. { 't :=
  179.   duplicate$ empty$
  180.     { pop$ "empty " t * " in " * cite$ * warning$ }
  181.     'output.nonnull
  182.   if$
  183. FUNCTION {output.check.colon}
  184. { 't :=
  185.   duplicate$ empty$
  186.     { pop$ "empty " t * " in " * cite$ * warning$ }
  187.     'output.nonnull.colon
  188.   if$
  189. FUNCTION {output.year.check}
  190. { year empty$
  191.      { "empty year in " cite$ * warning$ }
  192.      { write$
  193.         " (" year * extra.label *
  194.        month empty$
  195.           { ")" * }
  196.           { ", " * month * ")" * }
  197.        if$
  198.        mid.sentence 'output.state :=
  199.      }
  200.   if$
  201. FUNCTION {output.bibitem}
  202. { newline$
  203.   "\bibitem[" write$
  204.   label write$
  205.   "]{" write$
  206.   cite$ write$
  207.   "}" write$
  208.   newline$
  209.   before.all 'output.state :=
  210. FUNCTION {fin.entry}
  211. { add.period$
  212.   write$
  213.   newline$
  214. FUNCTION {new.block}
  215. { output.state before.all =
  216.     'skip$
  217.     { after.block 'output.state := }
  218.   if$
  219. FUNCTION {new.sentence}
  220. { output.state after.block =
  221.     'skip$
  222.     { output.state before.all =
  223.     'skip$
  224.     { after.sentence 'output.state := }
  225.       if$
  226.     }
  227.   if$
  228. FUNCTION {not}
  229. {   { #0 }
  230.     { #1 }
  231.   if$
  232. FUNCTION {and}
  233. {   'skip$
  234.     { pop$ #0 }
  235.   if$
  236. FUNCTION {or}
  237. {   { pop$ #1 }
  238.     'skip$
  239.   if$
  240. FUNCTION {new.block.checka}
  241. { empty$
  242.     'skip$
  243.     'new.block
  244.   if$
  245. FUNCTION {new.block.checkb}
  246. { empty$
  247.   swap$ empty$
  248.   and
  249.     'skip$
  250.     'new.block
  251.   if$
  252. FUNCTION {new.sentence.checka}
  253. { empty$
  254.     'skip$
  255.     'new.sentence
  256.   if$
  257. FUNCTION {new.sentence.checkb}
  258. { empty$
  259.   swap$ empty$
  260.   and
  261.     'skip$
  262.     'new.sentence
  263.   if$
  264. FUNCTION {field.or.null}
  265. { duplicate$ empty$
  266.     { pop$ "" }
  267.     'skip$
  268.   if$
  269. FUNCTION {underline}
  270. { duplicate$ empty$
  271.   { pop$ "" }
  272.   { "\underline{" swap$ * "}" * }
  273.   if$
  274. % Emphasize the top string on the stack.
  275. FUNCTION {emphasize}
  276. { duplicate$ empty$
  277.     { pop$ "" }
  278.     { "{\em " swap$ * "}" * }
  279.   if$
  280. % Emphasize the top string on the stack, but add a trailing space.
  281. FUNCTION {emphasize.space}
  282. { duplicate$ empty$
  283.     { pop$ "" }
  284.     { "{\em " swap$ * "\/}" * }
  285.   if$
  286. INTEGERS { nameptr namesleft numnames }
  287. % Format bibliographical entries with the first author last name first,
  288. % and subsequent authors with initials followed by last name.
  289. % All names are formatted in this routine.
  290. FUNCTION {format.names}
  291. { 's :=
  292.   #1 'nameptr :=               % nameptr = 1;
  293.   s num.names$ 'numnames :=    % numnames = num.name$(s);
  294.   numnames 'namesleft :=
  295.     { namesleft #0 > }
  296.     { nameptr #1 =
  297.         {s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := }
  298.         {s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
  299.       if$
  300.       nameptr #1 >
  301.         { namesleft #1 >
  302.               { ", " * t * }
  303.               { numnames #2 >
  304.                   { "," * }
  305.                   'skip$
  306.                 if$
  307.                 t "others" =
  308.                     { " et~al." * }
  309.                     { " and " * t * } % from Chicago Manual of Style
  310.                   if$
  311.                }
  312.                if$
  313.              }
  314.             't
  315.         if$
  316.         nameptr #1 + 'nameptr :=          % nameptr += 1;
  317.         namesleft #1 - 'namesleft :=      % namesleft =- 1;
  318.     }
  319.   while$
  320. FUNCTION {my.full.label}
  321. { 's :=
  322.   #1 'nameptr :=               % nameptr = 1;
  323.   s num.names$ 'numnames :=    % numnames = num.name$(s);
  324.   numnames 'namesleft :=
  325.     { namesleft #0 > }
  326.     { s nameptr "{vv~}{ll}" format.name$ 't :=  % get the next name
  327.       nameptr #1 >
  328.         { namesleft #1 >
  329.               { ", " * t * }
  330.               { numnames #2 >
  331.                   { "," * }
  332.                   'skip$
  333.                 if$
  334.                 t "others" =
  335.                     { " et~al." * }
  336.                     { " and " * t * } % from Chicago Manual of Style
  337.                   if$
  338.                }
  339.                if$
  340.              }
  341.             't
  342.         if$
  343.         nameptr #1 + 'nameptr :=          % nameptr += 1;
  344.         namesleft #1 - 'namesleft :=      % namesleft =- 1;
  345.     }
  346.   while$
  347. FUNCTION {format.names.fml}
  348. % Format names in "familiar" format, with first initial followed by
  349. % last name. Like format.names, ALL names are formatted.
  350. { 's :=
  351.   #1 'nameptr :=               % nameptr = 1;
  352.   s num.names$ 'numnames :=    % numnames = num.name$(s);
  353.   numnames 'namesleft :=
  354.     { namesleft #0 > }
  355.     { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
  356.       nameptr #1 >
  357.         { namesleft #1 >
  358.               { ", " * t * }
  359.                { numnames #2 >
  360.                     { "," * }
  361.                     'skip$
  362.                   if$
  363.                   t "others" =
  364.                         { " et~al." * }
  365.                         { " and " * t * }
  366. %                       { " \& " * t * }
  367.                       if$
  368.                 }
  369.                if$
  370.              }
  371.             't
  372.         if$
  373.         nameptr #1 + 'nameptr :=          % nameptr += 1;
  374.         namesleft #1 - 'namesleft :=      % namesleft =- 1;
  375.     }
  376.   while$
  377. FUNCTION {format.authors}
  378. { author empty$
  379.     { "" }
  380.     { author format.names }
  381.   if$
  382. FUNCTION {format.key}
  383. { empty$
  384.     { key field.or.null }
  385.     { "" }
  386.   if$
  387. % Format editor names for use in the "in" types: inbook, incollection,
  388. % inproceedings: first initial, then last names. When editors are the
  389. % LABEL for an entry, then format.editor is used which lists editors
  390. % by last name first.
  391. FUNCTION {format.editors.fml}
  392. { editor empty$
  393.     { "" }
  394.     { editor format.names.fml
  395.       editor num.names$ #1 >
  396.     { " (Eds.)" * }
  397.     { " (Ed.)" * }
  398.       if$
  399.     }
  400.   if$
  401. % Format editor names for use in labels, last names first.
  402. FUNCTION {format.editors}
  403. { editor empty$
  404.     { "" }
  405.     { editor format.names
  406.       editor num.names$ #1 >
  407.     { " (Eds.)" * }
  408.     { " (Ed.)" * }
  409.       if$
  410.     }
  411.   if$
  412. FUNCTION {format.title}
  413. { title empty$
  414.     { "" }
  415.     { title "t" change.case$ }
  416.   if$
  417. % Note that the APA style requres case changes
  418. % in article titles. The following does not
  419. % change cases. If you perfer it, uncomment the
  420. % following and comment out the above.
  421. %FUNCTION {format.title}
  422. %{ title empty$
  423. %    { "" }
  424. %    { title }
  425. %  if$
  426. FUNCTION {n.dashify}
  427. { 't :=
  428.     { t empty$ not }
  429.     { t #1 #1 substring$ "-" =
  430.     { t #1 #2 substring$ "--" = not
  431.         { "--" *
  432.           t #2 global.max$ substring$ 't :=
  433.         }
  434.         {   { t #1 #1 substring$ "-" = }
  435.         { "-" *
  436.           t #2 global.max$ substring$ 't :=
  437.         }
  438.           while$
  439.         }
  440.       if$
  441.     }
  442.     { t #1 #1 substring$ *
  443.       t #2 global.max$ substring$ 't :=
  444.     }
  445.       if$
  446.     }
  447.   while$
  448. FUNCTION {format.btitle}
  449. { edition empty$
  450.   { title emphasize }
  451.   { title empty$
  452.     { title emphasize }
  453.     { volume empty$     % gnp - check for volume, then don't need period
  454.        { "{\em " title * "\/} (" * edition * " ed.)" * "." * }
  455.        { "{\em " title * "\/} (" * edition * " ed.)" * }
  456.       if$
  457.     }
  458.     if$
  459.   if$
  460. FUNCTION {format.emphasize.booktitle}
  461. { edition empty$
  462.   { booktitle emphasize }
  463.   { booktitle empty$
  464.     { booktitle emphasize }
  465.     { volume empty$    % gnp - extra period an error if book has a volume
  466.         { "{\em " booktitle * "\/} (" * edition * " ed.)" * "." *}
  467.         { "{\em " booktitle * "\/} (" * edition * " ed.)" * }
  468.       if$
  469.       }
  470.     if$
  471.     }
  472.   if$
  473. FUNCTION {tie.or.space.connect}
  474. { duplicate$ text.length$ #3 <
  475.     { "~" }
  476.     { " " }
  477.   if$
  478.   swap$ * *
  479. FUNCTION {either.or.check}
  480. { empty$
  481.     'pop$
  482.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  483.   if$
  484. FUNCTION {format.bvolume}
  485. { volume empty$
  486.     { "" }
  487.     { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
  488.       series empty$
  489.         'skip$
  490.         { " of " * series emphasize * }
  491.       if$
  492.       "volume and number" number either.or.check
  493.     }
  494.   if$
  495. FUNCTION {format.number.series}
  496. { volume empty$
  497.     { number empty$
  498.     { series field.or.null }
  499.     { output.state mid.sentence =
  500.         { "Number" } % gnp - changed to mixed case always
  501.         { "Number" }
  502.       if$
  503.       number tie.or.space.connect
  504.       series empty$
  505.         { "there's a number but no series in " cite$ * warning$ }
  506.         { " in " * series * }
  507.       if$
  508.     }
  509.       if$
  510.     }
  511.     { "" }
  512.   if$
  513. INTEGERS { multiresult }
  514. FUNCTION {multi.page.check}
  515. { 't :=
  516.   #0 'multiresult :=
  517.     { multiresult not
  518.       t empty$ not
  519.       and
  520.     }
  521.     { t #1 #1 substring$
  522.       duplicate$ "-" =
  523.       swap$ duplicate$ "," =
  524.       swap$ "+" =
  525.       or or
  526.     { #1 'multiresult := }
  527.     { t #2 global.max$ substring$ 't := }
  528.       if$
  529.     }
  530.   while$
  531.   multiresult
  532. FUNCTION {format.pages}
  533. { pages empty$
  534.   { "" }
  535.   { pages multi.page.check
  536.     { "pp.\ " pages n.dashify tie.or.space.connect } % gnp - removed ()
  537.     { "pp.\ " pages tie.or.space.connect }
  538.     if$
  539.   if$
  540. % By Young (and Spencer)
  541. % GNP - fixed bugs with missing volume, number, and/or pages
  542. % Format journal, volume, number, pages for article types.
  543. FUNCTION {format.jour.vol}
  544. { journal empty$
  545.     { "no journal in " cite$ * warning$
  546.       "" }
  547.     { journal emphasize.space " " * }
  548.     if$
  549.   number empty$
  550.     { volume empty$
  551.        { "no number and no volume in " cite$ * warning$
  552.          "" * }
  553.        { "{\em " * Volume * "}" * }
  554.       if$
  555.     }
  556.     { volume empty$
  557.       {"no volume for " cite$ * warning$
  558.        "(" * number * ")" * }
  559.       { volume emphasize.space
  560.         "(" * number * ")" * * }
  561.       if$
  562.     }
  563.   if$
  564.   pages empty$
  565.     {"page numbers missing in " cite$ * warning$
  566.      "" } % gnp - place a null string on the stack for output
  567.     { duplicate$ empty$
  568.       { pop$ format.pages }
  569.       { ", " *  pages n.dashify * } % gnp - removed pp. for articles
  570.       if$
  571.     }
  572.   if$
  573. FUNCTION {format.chapter.pages}
  574. { chapter empty$
  575.     'format.pages
  576.     { type empty$
  577.         { "Chapter" } % gnp - changed to mixed case
  578.         { type "t" change.case$ }
  579.       if$
  580.       chapter tie.or.space.connect
  581.       pages empty$
  582.         {"page numbers missing in " cite$ * warning$} % gnp - added check
  583.         { ", " * format.pages * }
  584.       if$
  585.     }
  586.   if$
  587. FUNCTION {format.in.ed.booktitle}
  588. { booktitle empty$
  589.   { "" }
  590.   { editor empty$
  591.     { "In " format.emphasize.booktitle * }
  592.     { "In " format.editors.fml * ", " * format.emphasize.booktitle * }
  593.     if$
  594.   if$
  595. FUNCTION {format.thesis.type}
  596. { type empty$
  597.     'skip$
  598.     { pop$
  599.       type "t" change.case$
  600.     }
  601.   if$
  602. FUNCTION {format.tr.number}
  603. { type empty$
  604.     { "Technical Report" }
  605.     'type
  606.   if$
  607.   number empty$
  608.     { "t" change.case$ }
  609.     { number tie.or.space.connect }
  610.   if$
  611. FUNCTION {format.article.crossref}
  612. { "See"
  613.   "\citeN{" * crossref * "}" *
  614. FUNCTION {format.crossref.editor}
  615. { editor #1 "{vv~}{ll}" format.name$
  616.   editor num.names$ duplicate$
  617.   #2 >
  618.     { pop$ " et~al." * }
  619.     { #2 <
  620.     'skip$
  621.     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  622.         { " et~al." * }
  623.         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  624.       if$
  625.     }
  626.       if$
  627.     }
  628.   if$
  629. FUNCTION {format.book.crossref}
  630. { volume empty$
  631.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  632.       "In "
  633.     }
  634.     { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
  635.       " of " *
  636.     }
  637.   if$
  638.   editor empty$
  639.   editor field.or.null author field.or.null =
  640.     { key empty$
  641.     { series empty$
  642.         { "need editor, key, or series for " cite$ * " to crossref " *
  643.           crossref * warning$
  644.           "" *
  645.         }
  646.         { "{\em " * series * "\/}" * }
  647.       if$
  648.     }
  649.     { key * }
  650.       if$
  651.     }
  652.     { format.crossref.editor * }
  653.   if$
  654.   " \citeN{" * crossref * "}" *
  655. FUNCTION {format.incoll.inproc.crossref}
  656. { "See"
  657.   " \citeN{" * crossref * "}" *
  658. FUNCTION {article}
  659. { output.bibitem
  660.   format.authors
  661.   "author" output.check
  662.   author format.key output          % added
  663.   output.year.check                 % added
  664.   new.block
  665.   format.title
  666.   "title" output.check
  667.   new.block
  668.   crossref missing$
  669.     { format.jour.vol output
  670.     }
  671.     { format.article.crossref output.nonnull
  672.       format.pages output
  673.     }
  674.   if$
  675.   new.block
  676.   note output
  677.   fin.entry
  678. FUNCTION {book}
  679. { output.bibitem
  680.   author empty$
  681.     { format.editors
  682.       "author and editor" output.check }
  683.     { format.authors
  684.       output.nonnull
  685.       crossref missing$
  686.         { "author and editor" editor either.or.check }
  687.         'skip$
  688.       if$
  689.     }
  690.   if$
  691.   output.year.check       % added
  692.   new.block
  693.   format.btitle
  694.   "title" output.check
  695.   crossref missing$
  696.     { format.bvolume output
  697.       new.block
  698.       format.number.series output
  699.       new.sentence
  700.       address output
  701.       publisher "publisher" output.check.colon
  702.     }
  703.     { new.block
  704.       format.book.crossref output.nonnull
  705.     }
  706.   if$
  707.   new.block
  708.   note output
  709.   fin.entry
  710. FUNCTION {booklet}
  711. { output.bibitem
  712.   format.authors output
  713.   author format.key output          % added
  714.   output.year.check                 % added
  715.   new.block
  716.   format.title
  717.   "title" output.check
  718.   new.block
  719.   howpublished output
  720.   address output
  721.   new.block
  722.   note output
  723.   fin.entry
  724. FUNCTION {inbook}
  725. { output.bibitem
  726.   author empty$
  727.     { format.editors
  728.       "author and editor" output.check
  729.     }
  730.     { format.authors output.nonnull
  731.       crossref missing$
  732.     { "author and editor" editor either.or.check }
  733.     'skip$
  734.       if$
  735.     }
  736.   if$
  737.   output.year.check                 % added
  738.   new.block
  739.   format.btitle
  740.   "title" output.check
  741.   crossref missing$
  742.     { format.bvolume output
  743.       format.chapter.pages
  744.       "chapter and pages" output.check
  745.       new.block
  746.       format.number.series output
  747.       new.sentence
  748.       address output
  749.       publisher
  750.       "publisher" output.check.colon
  751.     }
  752.     { format.chapter.pages "chapter and pages" output.check
  753.       new.block
  754.       format.book.crossref output.nonnull
  755.     }
  756.   if$
  757.   new.block
  758.   note output
  759.   fin.entry
  760. FUNCTION {incollection}
  761. { output.bibitem
  762.   format.authors
  763.   "author" output.check
  764.   author format.key output       % added
  765.   output.year.check              % added
  766.   new.block
  767.   format.title
  768.   "title" output.check
  769.   new.block
  770.   crossref missing$
  771.   { format.in.ed.booktitle
  772.     "booktitle" output.check
  773.     format.bvolume output
  774.     format.number.series output
  775.     format.chapter.pages output % gnp - was special.output.nonnull
  776. %                                 left out comma before page numbers
  777.     new.sentence
  778.     address output
  779.     publisher "publisher" output.check.colon
  780.   { format.incoll.inproc.crossref
  781.     output.nonnull
  782.     format.chapter.pages output
  783.   if$
  784.   new.block
  785.   note output
  786.   fin.entry
  787. FUNCTION {inproceedings}
  788. { output.bibitem
  789.   format.authors
  790.   "author" output.check
  791.   author format.key output            % added
  792.   output.year.check                   % added
  793.   new.block
  794.   format.title
  795.   "title" output.check
  796.   new.block
  797.   crossref missing$
  798.     { format.in.ed.booktitle
  799.       "booktitle" output.check
  800.       format.bvolume output
  801.       format.number.series output
  802.       address output
  803.       format.pages output
  804.       new.sentence
  805.       organization output
  806.       publisher output.colon
  807.       }
  808.     { format.incoll.inproc.crossref output.nonnull
  809.       format.pages output
  810.     }
  811.   if$
  812.   new.block
  813.   note output
  814.   fin.entry
  815. FUNCTION {conference} { inproceedings }
  816. FUNCTION {manual}
  817. { output.bibitem
  818.   author empty$
  819.     { editor empty$
  820.       { organization "organization" output.check
  821.         organization format.key output }  % if all else fails, use key
  822.       { format.editors "author and editor" output.check }
  823.       if$
  824.     }
  825.     { format.authors output.nonnull }
  826.     if$
  827.   output.year.check                 % added
  828.   new.block
  829.   format.btitle
  830.   "title" output.check
  831.   organization address new.block.checkb
  832. % Reversed the order of "address" and "organization", added the ":".
  833.   address output
  834.   organization "organization" output.check.colon
  835. %  address output
  836. %  ":" output
  837. %  organization output
  838.   new.block
  839.   note output
  840.   fin.entry
  841. FUNCTION {mastersthesis}
  842. { output.bibitem
  843.   format.authors
  844.   "author" output.check
  845.   author format.key output          % added
  846.   output.year.check                 % added
  847.   new.block
  848.   format.title
  849.   "title" output.check
  850.   new.block
  851.   "Master's thesis" format.thesis.type output.nonnull
  852.   school "school" output.check
  853.   address output
  854.   new.block
  855.   note output
  856.   fin.entry
  857. FUNCTION {misc}
  858. { output.bibitem
  859.   format.authors output
  860.   author format.key output            % added
  861.   output.year.check                   % added
  862.   title howpublished new.block.checkb
  863.   format.title output
  864.   new.block
  865.   howpublished output
  866.   new.block
  867.   note output
  868.   fin.entry
  869. FUNCTION {phdthesis}
  870. { output.bibitem
  871.   format.authors
  872.   "author" output.check
  873.   author format.key output            % added
  874.   output.year.check                   % added
  875.   new.block
  876.   format.btitle
  877.   "title" output.check
  878.   new.block
  879.   "Ph.\ D. thesis" format.thesis.type output.nonnull
  880.   school "school" output.check
  881.   address output
  882.   new.block
  883.   note output
  884.   fin.entry
  885. FUNCTION {proceedings}
  886. { output.bibitem
  887.   editor empty$
  888.     { organization output
  889.       organization format.key output }  % gnp - changed from author format.key
  890.     { format.editors output.nonnull }
  891.   if$
  892. % author format.key output             % gnp - removed (should be either
  893. %                                        editor or organization
  894.   output.year.check                    % added (newapa)
  895.   new.block
  896.   format.btitle
  897.   "title" output.check
  898.   format.bvolume output
  899.   format.number.series output
  900.   address output
  901.   new.sentence
  902.   organization output
  903.   publisher output.colon
  904.   new.block
  905.   note output
  906.   fin.entry
  907. FUNCTION {techreport}
  908. { output.bibitem
  909.   format.authors
  910.   "author" output.check
  911.   author format.key output             % added
  912.   output.year.check                    % added
  913.   new.block
  914.   format.title
  915.   "title" output.check
  916.   new.block
  917.   format.tr.number output.nonnull
  918.   institution
  919.   "institution" output.check
  920.   address output
  921.   new.block
  922.   note output
  923.   fin.entry
  924. FUNCTION {unpublished}
  925. { output.bibitem
  926.   format.authors
  927.   "author" output.check
  928.   author format.key output              % added
  929.   output.year.check                      % added
  930.   new.block
  931.   format.title
  932.   "title" output.check
  933.   new.block
  934.   note "note" output.check
  935.   fin.entry
  936. FUNCTION {default.type} { misc }
  937. MACRO {jan} {"January"}
  938. MACRO {feb} {"February"}
  939. MACRO {mar} {"March"}
  940. MACRO {apr} {"April"}
  941. MACRO {may} {"May"}
  942. MACRO {jun} {"June"}
  943. MACRO {jul} {"July"}
  944. MACRO {aug} {"August"}
  945. MACRO {sep} {"September"}
  946. MACRO {oct} {"October"}
  947. MACRO {nov} {"November"}
  948. MACRO {dec} {"December"}
  949. MACRO {acmcs} {"ACM Computing Surveys"}
  950. MACRO {acta} {"Acta Informatica"}
  951. MACRO {ai} {"Artificial Intelligence"}
  952. MACRO {cacm} {"Communications of the ACM"}
  953. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  954. MACRO {ibmsj} {"IBM Systems Journal"}
  955. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  956. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  957. MACRO {ieeetcad}
  958.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  959. MACRO {ipl} {"Information Processing Letters"}
  960. MACRO {jacm} {"Journal of the ACM"}
  961. MACRO {jcss} {"Journal of Computer and System Sciences"}
  962. MACRO {scp} {"Science of Computer Programming"}
  963. MACRO {sicomp} {"SIAM Journal on Computing"}
  964. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  965. MACRO {tods} {"ACM Transactions on Database Systems"}
  966. MACRO {tog} {"ACM Transactions on Graphics"}
  967. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  968. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  969. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  970. MACRO {tcs} {"Theoretical Computer Science"}
  971. FUNCTION {sortify}
  972. { purify$
  973.   "l" change.case$
  974. INTEGERS { len }
  975. FUNCTION {chop.word}
  976. { 's :=
  977.   'len :=
  978.   s #1 len substring$ =
  979.     { s len #1 + global.max$ substring$ }
  980.     's
  981.   if$
  982. % format.lab.names:
  983. % determines "short" names for the abbreviated author information.
  984. % "Long" labels are created in calc.label, using the routine my.full.label
  985. % to format author and editor fields.
  986. % There are 4 cases for labels.   (n=3 in the example)
  987. % a) one author             Foo
  988. % b) one to n               Foo, Bar and Baz
  989. % c) use of "and others"    Foo, Bar et al.
  990. % d) more than n            Foo et al.
  991. FUNCTION {format.lab.names}
  992. { 's :=
  993.   s num.names$ 'numnames :=
  994.   numnames #2 >    % change number to number of others allowed before
  995.            % forcing "et al".
  996.     { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  997.     {
  998.       numnames #1 - 'namesleft :=
  999.       #2 'nameptr :=
  1000.       s #1 "{vv~}{ll}" format.name$
  1001.     { namesleft #0 > }
  1002.     { nameptr numnames =
  1003.         { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1004.         { " et~al." * }
  1005.         { " and " * s nameptr "{vv~}{ll}" format.name$ * }
  1006.           if$
  1007.         }
  1008.         { ", " * s nameptr "{vv~}{ll}" format.name$ * }
  1009.       if$
  1010.       nameptr #1 + 'nameptr :=
  1011.       namesleft #1 - 'namesleft :=
  1012.       while$
  1013.     }
  1014.   if$
  1015. FUNCTION {author.key.label}
  1016. { author empty$
  1017.     { key empty$
  1018.           { "no key, author in " cite$ * warning$
  1019.             cite$ #1 #3 substring$ }
  1020.          'key
  1021.       if$
  1022.     }
  1023.     { author format.lab.names }
  1024.   if$
  1025. FUNCTION {editor.key.label}
  1026. { editor empty$
  1027.     { key empty$
  1028.           { "no key, ed. in " cite$ * warning$
  1029.             cite$ #1 #3 substring$ }
  1030.           'key
  1031.         if$
  1032.      }
  1033.      { editor format.lab.names }
  1034.   if$
  1035. FUNCTION {author.key.organization.label}
  1036. % added - gnp. Provide label formatting by organization if author is null.
  1037. { author empty$
  1038.     { organization empty$
  1039.     { key empty$
  1040.         { "no key, author or org. in " cite$ * warning$
  1041.               cite$ #1 #3 substring$ }
  1042.         'key
  1043.       if$
  1044.         { organization text.length$ #30 >
  1045.           { "org. too long, using key= in " cite$ * warning$
  1046.             key }
  1047.           { organization }
  1048.           if$
  1049.         }
  1050.       if$
  1051.     }
  1052.     { author format.lab.names }
  1053.   if$
  1054. FUNCTION {editor.key.organization.label}
  1055. % added - gnp. Provide label formatting by organization if editor is null.
  1056. { editor empty$
  1057.     { organization empty$
  1058.     { key empty$
  1059.         { "no key, editor or org. in " cite$ * warning$
  1060.               cite$ #1 #3 substring$ }
  1061.         'key
  1062.       if$
  1063.         { organization text.length$ #30 >
  1064.           { "org. too long, using key= in " cite$ * warning$
  1065.             key }
  1066.           { organization }
  1067.           if$
  1068.         }
  1069.       if$
  1070.     }
  1071.     { editor format.lab.names }
  1072.   if$
  1073. FUNCTION {author.editor.key.label}
  1074. { author empty$
  1075.     { editor empty$
  1076.           { key empty$
  1077.                { "no key, author, or editor in " cite$ * warning$
  1078.                  cite$ #1 #3 substring$ }
  1079.              'key
  1080.            if$
  1081.          }
  1082.           { editor format.lab.names }
  1083.       if$
  1084.     }
  1085.     { author format.lab.names }
  1086.   if$
  1087. FUNCTION {calc.label}
  1088. % Changed - GNP. See also author.organization.sort, editor.organization.sort
  1089. % Form label for BibTeX entry. The classification of which fields are used
  1090. % for which type of entry (book, inbook, etc.) are taken from alpha.bst.
  1091. % The change here from newapa is to also include organization as a
  1092. % citation label if author or editor is missing.
  1093. { type$ "book" =
  1094.   type$ "inbook" =
  1095.     'author.editor.key.label
  1096.     { type$ "proceedings" =
  1097.     'editor.key.organization.label
  1098.     { type$ "manual" =
  1099.         'author.key.organization.label
  1100.         'author.key.label
  1101.       if$
  1102.       if$
  1103.     }
  1104.   if$
  1105.   duplicate$
  1106.   author empty$  % generate the full label citation information.
  1107.     { editor empty$
  1108.         { organization empty$
  1109.            { "no author, ed., org. for label in " cite$ * warning$
  1110.              "??" }
  1111.            { organization }
  1112.            if$
  1113.         }
  1114.         { editor my.full.label }
  1115.         if$
  1116.     }
  1117.     { author my.full.label }
  1118.   if$
  1119.   "\protect\citeauthoryear{" swap$ * "}{" * swap$ * "}{" *
  1120.   year field.or.null purify$ #-1 #4 substring$ *
  1121.   'label :=
  1122.   year field.or.null purify$ #-1 #4 substring$ *
  1123.   sortify 'sort.label :=
  1124. FUNCTION {sort.format.names}
  1125. { 's :=
  1126.   #1 'nameptr :=
  1127.   s num.names$ 'numnames :=
  1128.   numnames 'namesleft :=
  1129.     { namesleft #0 > }
  1130.     { nameptr #1 >
  1131.           { "   " * }
  1132.          'skip$
  1133.       if$
  1134.       s nameptr "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}" format.name$ 't :=
  1135.       nameptr numnames = t "others" = and
  1136.           { " et~al" * }
  1137.           { t sortify * }
  1138.       if$
  1139.       nameptr #1 + 'nameptr :=
  1140.       namesleft #1 - 'namesleft :=
  1141.     }
  1142.   while$
  1143. FUNCTION {sort.format.title}
  1144. { 't :=
  1145.   "A " #2
  1146.     "An " #3
  1147.       "The " #4 t chop.word
  1148.     chop.word
  1149.   chop.word
  1150.   sortify
  1151.   #1 global.max$ substring$
  1152. FUNCTION {author.sort}
  1153. { author empty$
  1154.     { key empty$
  1155.          { "to sort, need author or key in " cite$ * warning$
  1156.            "" }
  1157.          { key sortify }
  1158.       if$
  1159.     }
  1160.     { author sort.format.names }
  1161.   if$
  1162. FUNCTION {editor.sort}
  1163. { editor empty$
  1164.     { key empty$
  1165.          { "to sort, need editor or key in " cite$ * warning$
  1166.            ""
  1167.          }
  1168.          { key sortify }
  1169.       if$
  1170.     }
  1171.     { editor sort.format.names }
  1172.   if$
  1173. FUNCTION {author.editor.sort}
  1174. { author empty$
  1175.     { "missing author in " cite$ * warning$
  1176.       editor empty$
  1177.          { key empty$
  1178.              { "to sort, need author, editor, or key in " cite$ * warning$
  1179.                ""
  1180.              }
  1181.              { key sortify }
  1182.            if$
  1183.          }
  1184.          { editor sort.format.names }
  1185.       if$
  1186.     }
  1187.     { author sort.format.names }
  1188.   if$
  1189. FUNCTION {author.organization.sort}
  1190. % added - GNP. Stack author or organization for sorting (from alpha.bst).
  1191. % Unlike alpha.bst, we need entire names, not abbreviations
  1192. { author empty$
  1193.     { organization empty$
  1194.     { key empty$
  1195.         { "to sort, need author, organization, or key in " cite$ * warning$
  1196.           ""
  1197.         }
  1198.         { key sortify }
  1199.       if$
  1200.     { organization sortify }
  1201.       if$
  1202.     }
  1203.     { author sort.format.names }
  1204.   if$
  1205. FUNCTION {editor.organization.sort}
  1206. % added - GNP. Stack editor or organization for sorting (from alpha.bst).
  1207. % Unlike alpha.bst, we need entire names, not abbreviations
  1208. { editor empty$
  1209.     { organization empty$
  1210.     { key empty$
  1211.         { "to sort, need editor, organization, or key in " cite$ * warning$
  1212.           ""
  1213.         }
  1214.         { key sortify }
  1215.       if$
  1216.     { organization sortify }
  1217.       if$
  1218.     }
  1219.     { editor sort.format.names }
  1220.   if$
  1221. FUNCTION {presort}
  1222. % Presort creates the bibentry's label via a call to calc.label, and then
  1223. % sorts the entries based on entry type. Chicago.bst adds support for
  1224. % including organizations as the sort key; the following is stolen from
  1225. % alpha.bst.
  1226. { calc.label
  1227.   label sortify
  1228.   "    "
  1229.   type$ "book" =
  1230.   type$ "inbook" =
  1231.     'author.editor.sort
  1232.     { type$ "proceedings" =
  1233.     'editor.organization.sort
  1234.     { type$ "manual" =
  1235.         'author.organization.sort
  1236.         'author.sort
  1237.       if$
  1238.       if$
  1239.     }
  1240.   if$
  1241.   #1 entry.max$ substring$        % added for newapa
  1242.   'sort.label :=                  % added for newapa
  1243.   sort.label                      % added for newapa
  1244.   "    "
  1245.   title field.or.null
  1246.   sort.format.title
  1247.   #1 entry.max$ substring$
  1248.   'sort.key$ :=
  1249. ITERATE {presort}
  1250. SORT             % by label, sort.label, title --- for final label calculation
  1251. STRINGS { last.label next.extra }
  1252. INTEGERS { last.extra.num }
  1253. FUNCTION {initialize.extra.label.stuff}
  1254. { #0 int.to.chr$ 'last.label :=
  1255.   "" 'next.extra :=
  1256.   #0 'last.extra.num :=
  1257. FUNCTION {forward.pass}
  1258. { last.label label =
  1259.      { last.extra.num #1 + 'last.extra.num :=
  1260.        last.extra.num int.to.chr$ 'extra.label :=
  1261.      }
  1262.      { "a" chr.to.int$ 'last.extra.num :=
  1263.        "" 'extra.label :=
  1264.        label 'last.label :=
  1265.     }
  1266.   if$
  1267. FUNCTION {reverse.pass}
  1268. { next.extra "b" =
  1269.     { "a" 'extra.label := }
  1270.      'skip$
  1271.   if$
  1272.   label extra.label * "}" * 'label :=
  1273.   extra.label 'next.extra :=
  1274. EXECUTE {initialize.extra.label.stuff}
  1275. ITERATE {forward.pass}
  1276. REVERSE {reverse.pass}
  1277. FUNCTION {bib.sort.order}
  1278. { sort.label
  1279.   "    "
  1280.   year field.or.null sortify
  1281.   "    "
  1282.   title field.or.null
  1283.   sort.format.title
  1284.   #1 entry.max$ substring$
  1285.   'sort.key$ :=
  1286. ITERATE {bib.sort.order}
  1287. SORT             % by sort.label, year, title --- giving final bib. order.
  1288. FUNCTION {begin.bib}
  1289. { preamble$ empty$
  1290.     'skip$
  1291.     { preamble$ write$ newline$ }
  1292.   if$
  1293.   "\begin{thebibliography}{}" write$ newline$
  1294. EXECUTE {begin.bib}
  1295. EXECUTE {init.state.consts}
  1296. ITERATE {call.type$}
  1297. FUNCTION {end.bib}
  1298. { newline$
  1299.   "\end{thebibliography}" write$ newline$
  1300. EXECUTE {end.bib}
  1301.